package com.alibaba.android.alphasample;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.StatFs;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.alibaba.android.alpha.OnProjectExecuteListener;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final TextView text = (TextView) findViewById(R.id.task_log);
        text.setMovementMethod(new ScrollingMovementMethod());
        ConfigTest test = new ConfigTest(getApplicationContext());
        test.setOnProjectExecuteListener(new OnProjectExecuteListener() {
            @Override
            public void onProjectStart() {

            }

            @Override
            public void onTaskFinish(String taskName) {

            }

            @Override
            public void onProjectFinish() {
                new Handler(Looper.getMainLooper()).post(new Runnable() {
                    @Override
                    public void run() {
                        text.setText(MyLog.getLogString());
                    }
                });
            }
        });
        test.start();
    }

    public void getBlockSize(View view) {
        long blockSizeLong = new StatFs("/data").getBlockSizeLong();
        Log.i("wangweijun", "blockSizeLong:" + blockSizeLong);

    }
}